export type TypeMeta = {
  kind?: string;
  apiVersion?: string;
};

interface ListMeta {
  selfLink?: string;
  resourceVersion?: string;
  continue?: string;
  remainingItemCount?: number;
}

export type ListResponse<T = any> = _ListType<T>;
type _ListType<T = any> = TypeMeta & {
  metadata?: ListMeta;
  items?: T[];
};

export type ClusterOption = { clusterName?: string };

export type ListOption = TypeMeta &
  ClusterOption & {
    labelSelector?: string;
    fieldSelector?: string;
    resourceVersion?: string;
    timeoutSeconds?: number;
    limit?: number;
    continue?: string;
    sendInitialEvents?: boolean;
  };
export interface ObjectMeta {
  name?: string;
  generateName?: string;
  namespace?: string;
  uid?: string;
  resourceVersion?: string;

  generation?: number;
  creationTimestamp?: string;
  deletionTimestamp?: string;
  deletionGracePeriodSeconds?: number;
  labels?: { [key: string]: string };
  annotations?: { [key: string]: string };
  ownerReferences?: OwnerReference[];
  finalizers?: string[];
  managedFields?: ManagedFieldEntity[];
}

export type BaseResource = TypeMeta & {
  metadata?: ObjectMeta;
};

interface OwnerReference {
  apiVersion?: string;
  kind?: string;
  name?: string;
  uid?: string;
  controller?: boolean;
  blockOwnerDeletion?: boolean;
}

type ManagedFieldOperationType = "Apply" | "Update";

export interface ManagedFieldEntity {
  manager?: string;
  operation?: ManagedFieldOperationType;
  apiVersion?: string;
  time?: string;
  fieldsType?: string;
  subresource?: string;
}

interface NodeSpec {
  podCIDR?: string;
  podCIDRs?: string[];
  providerID?: string;
  unschedulable?: boolean;
  taints?: Taint[];
  configSource?: NodeConfigSource;
  externalID?: string;
}

export type TaintEffect = "NoSchedule" | "PreferNoSchedule" | "NoExecute";
export interface Taint {
  key?: string;
  value?: string;
  effect?: TaintEffect;
  timeAdded?: string;
}

interface NodeConfigSource {
  configMap?: ConfigMapNodeConfigSource;
}

interface ConfigMapNodeConfigSource {
  namespace?: string;
  name?: string;
  uid?: string;
  resourceVersion?: string;
  kubeletConfigKeys?: string;
}

interface NodeStatus {
  capacity?: ResourceList;
  allocatable?: ResourceList;
  phase?: NodePhase;
  conditions?: NodeCondition[];
  addresses?: NodeAddress[];
  daemonEndpoints?: NodeDomainEndpoints;
  nodeInfo?: NodeSystemInfo;
  images?: ContainerImage[];
  volumesInUse?: string[];
  volumesAttached?: AttachedVolume[];
  config?: NodeConfigStatus;
  runtimeHandlers?: NodeRuntimeHandler[];
  features?: NodeFeatures;
}

interface NodeRuntimeHandler {
  name?: string;
  features?: NodeRuntimeHandlerFeatures;
}

interface NodeFeatures {
  supplementalGroupsPolicy?: boolean;
}
interface NodeRuntimeHandlerFeatures {
  recursiveReadOnlyMounts?: boolean;
  userNamespaces?: boolean;
}

type NodePhase = "Pending" | "Running" | "Succeeded" | "Failed" | "Unknown";

type ResourceName = "cpu" | "memory" | "storage" | "ephemeral-storage" | "pods";
type ResourceList = {
  [key in ResourceName]?: any;
};

interface ResourceHealth {
  resourceID?: string;
  health?: ResourceHealthStatus;
}
type ResourceHealthStatus = "Healthy" | "Unhealthy" | "Unknown";

interface ResourceClaim {
  name?: string;
  request?: string;
}

type NodeConditionType =
  | "Ready"
  | "MemoryPressure"
  | "DiskPressure"
  | "PIDPressure"
  | "NetworkUnavailable";

export type ConditionStatus = "True" | "False" | "Unknown";

export interface NodeCondition {
  type?: NodeConditionType;
  status?: ConditionStatus;
  lastHeartbeatTime?: string;
  lastTransitionTime?: string;
  reason?: string;
  message?: string;
}

interface NodeSystemInfo {
  machineID?: string;
  systemUUID?: string;
  bootID?: string;
  kernelVersion?: string;
  osImage?: string;
  containerRuntimeVersion?: string;
  kubeletVersion?: string;
  kubeProxyVersion?: string;
  operatingSystem?: string;
  architecture?: string;
  swap?: {
    capacity?: number;
  };
}

interface NodeConfigStatus {
  assigned?: NodeConfigStatus;
  active?: NodeConfigSource;
  lastKnownGood?: NodeConfigSource;
  error?: string;
}

interface ContainerImage {
  names?: string[];
  sizeBytes?: number;
}

interface AttachedVolume {
  name?: string;
  devicePath?: string;
}

type NodeAddressType =
  | "Hostname"
  | "InternalIP"
  | "ExternalIP"
  | "InternalDNS"
  | "ExternalDNS";

interface DomainEndpoint {
  port?: number;
}

interface NodeDomainEndpoints {
  kubeletEndpoint?: DomainEndpoint;
}

interface NodeAddress {
  type?: NodeAddressType;
  address?: string;
}

export type NodeInfo = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: NodeSpec;
  status?: NodeStatus;
};

export type NodeList = TypeMeta &
  ListMeta & {
    items?: NodeInfo[];
  };

export type Pod = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: PodSpec;
  status?: PodStatus;
};

type DNSPolicy =
  | "ClusterFirstWithHostNet"
  | "ClusterFirst"
  | "Default"
  | "None";

type RestartPolicy = "Always" | "OnFailure" | "Never";

export interface PodSpec {
  volumes?: Volume[];
  initContainers?: Container[];
  containers?: Container[];
  ephemeralContainers?: EphemeralContainer[];
  restartPolicy?: RestartPolicy;
  terminationGracePeriodSeconds?: number;
  activeDeadlineSeconds?: number;
  dnsPolicy?: DNSPolicy;
  nodeSelector?: { [key: string]: string };
  serviceAccountName?: string;
  serviceAccount?: string;
  automountServiceAccountToken?: boolean;
  nodeName?: string;
  hostNetwork?: boolean;
  hostPID?: boolean;
  hostIPC?: boolean;
  shareProcessNamespace?: boolean;
  securityContext?: PodSecurityContext;
  imagePullSecrets?: LocalObjectReference[];
  hostname?: string;
  subdomain?: string;
  affinity?: Affinity;
  schedulerName?: string;
  tolerations?: Toleration[];
  hostAliases?: HostAlias[];
  priorityClassName?: string;
  priority?: number;
  dnsConfig?: PodDNSConfig;
  readinessGates?: PodReadinessGate[];
  runtimeClassName?: string;
  enableServiceLinks?: boolean;
  preemptionPolicy?: PreemptionPolicy;
  overhead?: ResourceList;
  topologySpreadConstraints?: TopologySpreadConstraint[];
  setHostnameAsFQDN?: boolean;
  os?: PodOS;
  hostUsers?: boolean;
  schedulingGates?: PodSchedulingGate[];
  resourceClaims?: PodResourceClaim[];
  resources?: ResourceRequirements;
}

interface PodStatus {
  observedGeneration?: number;
  phase?: PodPhase;
  conditions?: PodCondition[];
  message?: string;
  reason?: string;
  nominatedNodeName?: string;
  hostIP?: string;
  hostIPs?: HostIP[];
  podIP?: string;
  podIPs?: PodIP[];
  startTime?: string;
  initContainerStatuses?: ContainerStatus[];
  containerStatuses?: ContainerStatus[];
  qosClass?: PodQOSClass;
  ephemeralContainerStatuses?: ContainerStatus[];
  resize?: PodResizeStatus;
  resourceClaimstatuses?: PodResourceClaimStatus[];
}

type PodPhase = "Pending" | "Running" | "Succeeded" | "Failed" | "Unknown";

export interface PodCondition {
  type?: PodConditionType;
  observedGeneration?: number;
  status?: ConditionStatus;
  lastProbeTime?: string;
  lastTransitionTime?: string;
  reason?: string;
  message?: string;
}

export interface ContainerStatus {
  name?: string;
  state?: ContainerState;
  lastState?: ContainerState;
  ready?: boolean;
  restartCount?: number;
  image?: string;
  imageID?: string;
  containerID?: string;
  started?: boolean;
  allocatedResources?: ResourceList;
  resources?: ResourceRequirements;
  volumeMounts?: VolumeMountStatus[];
  user?: ContainerUser;
  allocatedResourcesStatus?: ResourceStatus[];
  stopSignal?: Signal;
}

interface ContainerUser {
  linux?: LinuxContainerUser;
}

interface LinuxContainerUser {
  uid?: number;
  gid?: number;
  supplementalGroups?: number[];
}

export interface ContainerState {
  waiting?: ContainerStateWaiting;
  running?: ContainerStateRunning;
  terminated?: ContainerStateTerminated;
}

interface ContainerStateBase {
  reason?: string;
  message?: string;
}

type ContainerStateWaiting = ContainerStateBase & {};
interface ContainerStateRunning {
  startedAt?: string;
}
type ContainerStateTerminated = ContainerStateBase & {
  exitCode?: number;
  signal?: number;
  startedAt?: string;
  finishedAt?: string;
  containerID?: string;
};

interface ResourceStatus {
  name?: ResourceName;
  resources?: ResourceHealth[];
}

type PodResizeStatus = "InProgress" | "Deferred" | "Infeasible";

interface PodResourceClaimStatus {
  name?: string;
  resourceClaimName?: string;
}

type PodQOSClass = "Guaranteed" | "Burstable" | "BestEffort";
interface HostIP {
  ip?: string;
}

interface PodIP {
  ip?: string;
}

export interface Container {
  name?: string;
  image?: string;
  command?: string[];
  args?: string[];
  workingDir?: string;
  ports?: ContainerPort[];
  envFrom?: EnvFromSource[];
  env?: EnvVar[];
  resources?: ResourceRequirements;
  resizePolicy?: ContainerResizePolicy;
  restartPolicy?: ContainerRestartPolicy;
  volumeMounts?: VolumeMount[];
  volumeDevices?: VolumeDevice[];
  livenessProbe?: Probe;
  readinessProbe?: Probe;
  startupProbe?: Probe;
  lifecycle?: Lifecycle;
  terminationMessagePath?: string;
  terminationMessagePolicy?: TerminationMessagePolicy;
  imagePullPolicy?: PullPolicy;
  securityContext?: SecurityContext;
  stdin?: boolean;
  stdinOnce?: boolean;
  tty?: boolean;
  state?: ContainerState;
}

type EphemeralContainer = EphemeralContainerCommon & {
  targetContainerName?: string;
};

interface EphemeralContainerCommon {
  name?: string;
  image?: string;
  command?: string[];
  args?: string[];
  workingDir?: string;
  ports?: ContainerPort[];
  envForm?: EnvFromSource[];
  env?: EnvVar[];
  resources?: ResourceRequirements;
  resizePolicy?: ContainerResizePolicy[];
  restartPolicy?: ContainerRestartPolicy;
  volumeMounts?: VolumeMount[];
  volumeDevices?: VolumeDevice[];
  livenessProbe?: Probe;
  readinessProbe?: Probe;
  startupProbe?: Probe;
  lifecycle?: Lifecycle;
  terminationMessagePath?: string;
  terminationMessagePolicy?: TerminationMessagePolicy;
  imagePullPolicy?: PullPolicy;
  securityContext?: SecurityContext;
  stdin?: boolean;
  stdinOnce?: boolean;
  tty?: boolean;
  targetContainerName?: string;
}

export interface ContainerPort {
  name?: string;
  hostPort?: number;
  containerPort?: number;
  protocol?: Protocol;
  hostIP?: string;
}

interface EnvFromSource {
  prefix?: string;
  configMapRef?: ConfigMapEnvSource;
  secretRef?: SecretEnvSource;
}
type ConfigMapEnvSource = LocalObjectReference & {
  optional?: boolean;
};
type SecretEnvSource = LocalObjectReference & {
  optional?: boolean;
};

export interface EnvVar {
  name?: string;
  value?: string;
  valueFrom?: EnvVarSource;
}

export interface EnvVarSource {
  fieldRef?: ObjectFieldSelector;
  resourceFieldRef?: ResourceFieldSelector;
  configMapKeyRef?: ConfigMapKeySelector;
  secretKeyRef?: SecretKeySelector;
}

type SecretKeySelector = LocalObjectReference & {
  key?: string;
  optional?: boolean;
};

type ConfigMapKeySelector = LocalObjectReference & {
  key?: string;
  optional?: boolean;
};

interface ContainerResizePolicy {
  resourceName?: ResourceName;
  restartPolicy?: ResourceResizeRestartPolicy;
}

type ResourceResizeRestartPolicy = "NotRequired" | "RestartContainer";
type ContainerRestartPolicy = "Always";
type RecursiveReadOnlyMode = "Disabled" | "IfPossible" | "Enabled";
type MountPropagationMode = "None" | "HostToContainer" | "Bidirectional";

export interface VolumeMount {
  name?: string;
  readOnly?: boolean;
  recursiveReadOnly?: RecursiveReadOnlyMode;
  mountPath?: string;
  subPath?: string;
  mountPropagation?: MountPropagationMode;
  subPathExpr?: string;
}

export interface VolumeMountStatus {
  name?: string;
  mountPath?: string;
  readOnly?: boolean;
  recursiveReadOnly?: RecursiveReadOnlyMode;
}

interface VolumeDevice {
  name?: string;
  devicePath?: string;
}

interface ProbHandler {
  exec?: ExecAction;
  httpGet?: HTTPGetAction;
  tcpSocket?: TCPSocketAction;
  grpc?: GRPCAction;
}

export type Probe = ProbHandler & {
  initialDelaySeconds?: number;
  timeoutSeconds?: number;
  periodSeconds?: number;
  successThreshold?: number;
  failureThreshold?: number;
  terminationGracePeriodSeconds?: number;
};

export interface SecurityContext {
  capabilities?: Capabilities;
  privileged?: boolean;
  seLinuxOptions?: SELinuxOptions;
  windowsOptions?: WindowsSecurityContextOptions;
  runAsUser?: number;
  runAsGroup?: number;
  runAsNonRoot?: boolean;
  readOnlyRootFilesystem?: boolean;
  allowPrivilegeEscalation?: boolean;
  procMount?: ProcMountType;
  apparmorProfile?: AppArmorProfile;
  seccompProfile?: SeccompProfile;
}

interface Lifecycle {
  postStart?: LifecycleHandler;
  preStop?: LifecycleHandler;
  stopSignal?: Signal;
}

enum Signal {
  SIGABRT = "SIGABRT",
  SIGALRM = "SIGALRM",
  SIGBUS = "SIGBUS",
  SIGCHLD = "SIGCHLD",
  SIGCLD = "SIGCLD",
  SIGCONT = "SIGCONT",
  SIGFPE = "SIGFPE",
  SIGHUP = "SIGHUP",
  SIGILL = "SIGILL",
  SIGINT = "SIGINT",
  SIGIO = "SIGIO",
  SIGIOT = "SIGIOT",
  SIGKILL = "SIGKILL",
  SIGPIPE = "SIGPIPE",
  SIGPOLL = "SIGPOLL",
  SIGPROF = "SIGPROF",
  SIGPWR = "SIGPWR",
  SIGQUIT = "SIGQUIT",
  SIGSEGV = "SIGSEGV",
  SIGSTKFLT = "SIGSTKFLT",
  SIGSTOP = "SIGSTOP",
  SIGSYS = "SIGSYS",
  SIGTERM = "SIGTERM",
  SIGTRAP = "SIGTRAP",
  SIGTSTP = "SIGTSTP",
  SIGTTIN = "SIGTTIN",
  SIGTTOU = "SIGTTOU",
  SIGURG = "SIGURG",
  SIGUSR1 = "SIGUSR1",
  SIGUSR2 = "SIGUSR2",
  SIGVTALRM = "SIGVTALRM",
  SIGWINCH = "SIGWINCH",
  SIGXCPU = "SIGXCPU",
  SIGXFSZ = "SIGXFSZ",
  SIGRTMIN = "SIGRTMIN",
  SIGRTMINPLUS1 = "SIGRTMIN+1",
  SIGRTMINPLUS2 = "SIGRTMIN+2",
  SIGRTMINPLUS3 = "SIGRTMIN+3",
  SIGRTMINPLUS4 = "SIGRTMIN+4",
  SIGRTMINPLUS5 = "SIGRTMIN+5",
  SIGRTMINPLUS6 = "SIGRTMIN+6",
  SIGRTMINPLUS7 = "SIGRTMIN+7",
  SIGRTMINPLUS8 = "SIGRTMIN+8",
  SIGRTMINPLUS9 = "SIGRTMIN+9",
  SIGRTMINPLUS10 = "SIGRTMIN+10",
  SIGRTMINPLUS11 = "SIGRTMIN+11",
  SIGRTMINPLUS12 = "SIGRTMIN+12",
  SIGRTMINPLUS13 = "SIGRTMIN+13",
  SIGRTMINPLUS14 = "SIGRTMIN+14",
  SIGRTMINPLUS15 = "SIGRTMIN+15",
  SIGRTMAXMINUS14 = "SIGRTMAX-14",
  SIGRTMAXMINUS13 = "SIGRTMAX-13",
  SIGRTMAXMINUS12 = "SIGRTMAX-12",
  SIGRTMAXMINUS11 = "SIGRTMAX-11",
  SIGRTMAXMINUS10 = "SIGRTMAX-10",
  SIGRTMAXMINUS9 = "SIGRTMAX-9",
  SIGRTMAXMINUS8 = "SIGRTMAX-8",
  SIGRTMAXMINUS7 = "SIGRTMAX-7",
  SIGRTMAXMINUS6 = "SIGRTMAX-6",
  SIGRTMAXMINUS5 = "SIGRTMAX-5",
  SIGRTMAXMINUS4 = "SIGRTMAX-4",
  SIGRTMAXMINUS3 = "SIGRTMAX-3",
  SIGRTMAXMINUS2 = "SIGRTMAX-2",
  SIGRTMAXMINUS1 = "SIGRTMAX-1",
  SIGRTMAX = "SIGRTMAX"
}

interface LifecycleHandler {
  exec?: ExecAction;
  httpGet?: HTTPGetAction;
  tcpSocket?: TCPSocketAction;
  sleep?: SleepAction;
}

interface ExecAction {
  command?: string[];
}

interface TCPSocketAction {
  port?: number | string;
  host?: string;
}

interface SleepAction {
  seconds?: number;
}

interface GRPCAction {
  port: number;
  service?: string;
}

type URIScheme = "HTTP" | "HTTPS";
interface HTTPGetAction {
  path?: string;
  port?: number | string;
  host?: string;
  scheme?: URIScheme;
  httpHeaders?: HTTPHeader[];
}

interface HTTPHeader {
  name?: string;
  value?: string;
}

interface Capabilities {
  add?: string[];
  drop?: string[];
}

type TerminationMessagePolicy = "File" | "FallbackToLogsOnError";
type ProcMountType = "Default" | "Unmasked";
type SupplementalGroupsPolicy = "Merge" | "Strict";

export interface PodSecurityContext {
  seLinuxOptions?: SELinuxOptions;
  windowsOptions?: WindowsSecurityContextOptions;
  runAsUser?: number;
  runAsGroup?: number;
  runAsNonRoot?: boolean;
  supplementalGroups?: number[];
  supplementalGroupsPolicy?: SupplementalGroupsPolicy;
  fsGroup?: number;
  sysctls?: Sysctl[];
  fsGroupChangePolicy?: PodFSGroupChangePolicy;
  seccompProfile?: SeccompProfile;
  appArmorProfile?: AppArmorProfile;
  seLinuxChangePolicy?: PodSELinuxChangePolicy;
}

interface SeccompProfile {
  type?: SeccompProfileType;
  labelhostProfile?: string;
}

interface AppArmorProfile {
  type?: AppArmorProfileType;
  labelhostProfile?: string;
}
type PodSELinuxChangePolicy = "Recursive" | "MountOption";
type AppArmorProfileType = "Unconfined" | "RuntimeDefault" | "Localhost";
type SeccompProfileType = "Unconfined" | "RuntimeDefault" | "Localhost";
type PodFSGroupChangePolicy = "OnRootMismatch" | "Always";

interface Sysctl {
  name?: string;
  value?: string;
}

interface SELinuxOptions {
  user?: string;
  role?: string;
  type?: string;
  level?: string;
}
interface WindowsSecurityContextOptions {
  gmsaCredentialSpecName?: string;
  gmsaCredentialSpec?: string;
  runAsUserName?: string;
  hostProcess?: string;
}

interface Affinity {
  nodeAffinity?: NodeAffinity;
  podAffinity?: PodAffinity;
  podAntiAffinity?: PodAntiAffinity;
}

interface NodeAffinity {
  requiredDuringSchedulingIgnoredDuringExecution?: NodeSelector;
  preferredDuringSchedulingIgnoredDuringExecution?: PreferredSchedulingTerm[];
}

interface PodAffinity {
  requiredDuringSchedulingIgnoredDuringExecution?: PodAffinityTerm[];
  preferredDuringSchedulingIgnoredDuringExecution?: WeightedPodAffinityTerm[];
}

interface PodAntiAffinity {
  requiredDuringSchedulingIgnoredDuringExecution?: PodAffinityTerm[];
  preferredDuringSchedulingIgnoredDuringExecution?: WeightedPodAffinityTerm[];
}

export interface WeightedPodAffinityTerm {
  weight?: number;
  podAffinityTerm?: PodAffinityTerm;
}

export interface PodAffinityTerm {
  labelSelector?: LabelSelector;
  namespaces?: string[];
  topologyKey?: string;
  namespaceSelector?: LabelSelector;
  matchLabelKeys?: string[];
  mismatchLabelKeys?: string[];
}

interface PreferredSchedulingTerm {
  weight?: number;
  preference?: NodeSelectorTerm;
}

interface PodDNSConfig {
  nameservers?: string[];
  searches?: string[];
  options?: DNSConfigOption[];
}

interface DNSConfigOption {
  name?: string;
  value?: string;
}

interface HostAlias {
  ip?: string;
  hostnames?: string[];
}

export interface Toleration {
  key?: string;
  operator?: "Equal" | "Exists";
  value?: string;
  effect?: TaintEffect;
  tolerationSeconds?: number;
}

type PodConditionType =
  | "ContainersReady"
  | "Initialized"
  | "Ready"
  | "PodScheduled"
  | "DisruptionTarget"
  | "PodReadyToStartContainers"
  | "PodResizePending"
  | "PodResizeInProgress";

interface PodReadinessGate {
  conditionType?: PodConditionType;
}

type PreemptionPolicy = "PreemptLowerPriority" | "Never";

type UnsatisfiableConstraintAction = "DoNotSchedule" | "ScheduleAnyway";
type NodeInclusionPolicy = "Ignore" | "Honor";

interface TopologySpreadConstraint {
  maxSkew?: number;
  topologyKey?: string;
  whenUnsatisfiable?: UnsatisfiableConstraintAction;
  labelSelector?: LabelSelector;
  minDomains?: number;
  nodeAffinityPolicy?: NodeInclusionPolicy;
  nodeTaintsPolicy?: NodeInclusionPolicy;
  matchLabelKeys?: string[];
}

type OSName = "linux" | "windows";
interface PodOS {
  name?: OSName;
}

interface PodSchedulingGate {
  name?: string;
}

interface PodResourceClaim {
  name?: string;
  resourceClaimName?: string;
  resourceClaimTemplateName?: string;
}

export interface ResourceRequirements {
  limits?: ResourceList;
  requests?: ResourceList;
  claims?: ResourceClaim;
}

export type Volume = VolumeSource & {
  name?: string;
};

type HostPathType =
  | ""
  | "DirectoryOrCreate"
  | "Directory"
  | "FileOrCreate"
  | "File"
  | "Socket"
  | "CharDevice"
  | "BlockDevice";

type StorageMedium = "" | "Memory" | "HugePages" | "HugePages-";
type Protocol = "TCP" | "UDP" | "SCTP";

interface VolumeSource {
  hostPath?: HostPathVolumeSource;
  emptyDir?: EmptyDirVolumeSource;
  gcePersistentDisk?: GcePersistentDiskVolumeSource;
  awsElasticBlockStore?: AwsElasticBlockStoreVolumeSource;
  gitRepo?: GitRepoVolumeSource;
  secret?: SecretVolumeSource;
  nfs?: NFSVolumeSource;
  iscsi?: ISCSIVolumeSource;
  glusterfs?: GlusterfsVolumeSource;
  persistentVolumeClaim?: PersistentVolumeClaimVolumeSource;
  rbd?: RBDVolumeSource;
  flexVolume?: FlexVolumeSource;
  cinder?: CinderVolumeSource;
  cephfs?: CephFSVolumeSource;
  flocker?: FlockerVolumeSource;
  downwardAPI?: DownwardAPIVolumeSource;
  fc?: FCVolumeSource;
  azureFile?: AzureFileVolumeSource;
  configMap?: ConfigMapVolumeSource;
  vsphereVolume?: VsphereVirtualDiskVolumeSource;
  quobyte?: QuobyteVolumeSource;
  azureDisk?: AzureDiskVolumeSource;
  photonPersistentDisk?: PhotonPersistentDiskVolumeSource;
  projected?: ProjectedVolumeSource;
  portworxVolume?: PortworxVolumeSource;
  scaleIO?: ScaleIOVolumeSource;
  storageos?: StorageOSVolumeSource;
  csi?: CSIVolumeSource;
  ephemeral?: EphemeralVolumeSource;
  image?: ImageVolumeSource;
}

interface ImageVolumeSource {
  reference?: string;
  pullPolicy?: PullPolicy;
}

type PullPolicy = "Always" | "Never" | "IfNotPresent";

interface EphemeralVolumeSource {
  volumeClaimTemplate?: PersistentVolumeClaimTemplate;
}

interface PersistentVolumeClaimTemplate {
  metadata?: ObjectMeta;
  spec?: PersistentVolumeClaimSpec;
}

interface ServiceAccountTokenProjection {
  audience?: string;
  expirationSeconds?: number;
  path?: string;
}

interface ProjectedVolumeSource {
  sources?: VolumeProjection[];
  defaultMode?: number;
}

interface VolumeProjection {
  secret?: SecretReference;
  downwardAPI?: DownwardAPIProjection;
  configMap?: ConfigMapProjection;
  serviceAccountToken?: ServiceAccountTokenProjection;
  clusterTrustBundle?: ClusterTrustBundleProjection;
}

interface ClusterTrustBundleProjection {
  name?: string;
  singerName?: string;
  labelSelector?: LabelSelector;
  optional?: boolean;
  path?: string;
}

export interface LabelSelector {
  matchLabels?: { [key: string]: string };
  matchExpressions?: LabelSelectorRequirement[];
}

export interface NodeSelector {
  nodeSelectorTerms?: NodeSelectorTerm[];
}

export interface NodeSelectorTerm {
  matchExpressions?: NodeSelectorRequirement[];
  matchFields?: NodeSelectorRequirement[];
}

export interface NodeSelectorRequirement {
  key?: string;
  operator?: NodeSelectorOperator;
  values?: string[];
}
type NodeSelectorOperator =
  | "In"
  | "NotIn"
  | "Exists"
  | "DoesNotExist"
  | "Gt"
  | "Lt";
export type LabelSelectorOperator = "In" | "NotIn" | "Exists" | "DoesNotExist";
export interface LabelSelectorRequirement {
  key?: string;
  operator?: LabelSelectorOperator;
  values?: string[];
}

interface DownwardAPIProjection {
  items?: DownwardAPIVolumeFile[];
}

interface DownwardAPIVolumeSource {
  items?: DownwardAPIVolumeFile[];
  defaultMode?: number;
}

interface DownwardAPIVolumeFile {
  path?: string;
  fieldRef?: ObjectFieldSelector;
  resourceFieldRef?: ResourceFieldSelector;
  mode?: number;
}

interface ObjectFieldSelector {
  apiVersion?: string;
  fieldPath?: string;
}

interface ResourceFieldSelector {
  containerName?: string;
  resource?: string;
  divisor?: Quantity;
}

interface GlusterfsVolumeSource {
  endpoints?: string;
  path?: string;
  readOnly?: boolean;
}

interface PersistentVolumeClaimVolumeSource {
  claimName?: string;
  readOnly?: boolean;
}

interface PersistentVolumeSource {
  gcePersistentDisk?: GcePersistentDiskVolumeSource;
  awsElasticBlockStore?: AwsElasticBlockStoreVolumeSource;
  hostPath?: HostPathVolumeSource;
  glusterfs?: GlusterfsVolumeSource;
  nfs?: NFSVolumeSource;
  rbd?: RBDPersistentVolumeSource;
  iscsi?: ISCSIPersistentVolumeSource;
  cinder?: CinderPersistentVolumeSource;
  cephfs?: CephFSPersistentVolumeSource;
  fc?: FCVolumeSource;
  flocker?: FlockerVolumeSource;
  flexvolume?: FlexPersistentVolumeSource;
  azureFile?: AzureFilePersistentVolumeSource;
  vsphereVolume?: VsphereVirtualDiskVolumeSource;
  quobyte?: QuobyteVolumeSource;
  azureDisk?: AzureDiskVolumeSource;
  photonPersistentDisk?: PhotonPersistentDiskVolumeSource;
  portworxVolume?: PortworxVolumeSource;
  scaleIO?: ScaleIOVolumeSource;
  local?: LocalVolumeSource;
  storageOS?: StorageOSPersistentVolumeSource;
  csi?: CSIPersistentVolumeSource;
}

interface LocalVolumeSource {
  path?: string;
  fsType?: string;
}

interface CephFSVolumeSource {
  monitors?: string[];
  path?: string;
  user?: string;
  secretFile?: string;
  secretRef?: LocalObjectReference;
  readOnly?: boolean;
}

type CephFSPersistentVolumeSource = CephFSVolumeSource & {};

interface FlockerVolumeSource {
  datasetName?: string;
  datasetUUID?: string;
}

interface QuobyteVolumeSource {
  registry?: string;
  volume?: string;
  readOnly?: boolean;
  user?: string;
  group?: string;
  tenant?: string;
}
interface FlexVolumeSource {
  driver?: string;
  fsType?: string;
  secretRef?: SecretReference;
  readonly?: boolean;
  options?: { [key: string]: string };
}
type FlexPersistentVolumeSource = FlexVolumeSource & {};

interface CinderVolumeSource {
  volumeID?: string;
  fsType?: string;
  readOnly?: boolean;
  secretRef?: SecretReference;
}

type CinderPersistentVolumeSource = CinderVolumeSource & {};

interface RBDVolumeSource {
  monitors?: string[];
  image?: string;
  fsType?: string;
  pool?: string;
  user?: string;
  keyring?: string;
  secretRef?: SecretReference;
  readOnly?: boolean;
}
type RBDPersistentVolumeSource = RBDVolumeSource & {};

interface GcePersistentDiskVolumeSource {
  pdName?: string;
  fsType?: string;
  partition?: number;
  readOnly?: boolean;
}

interface AwsElasticBlockStoreVolumeSource {
  volumeID?: string;
  fsType?: string;
  partition?: number;
  readOnly?: boolean;
}

interface GitRepoVolumeSource {
  repository?: string;
  revision?: string;
  directory?: string;
}

interface SecretVolumeSource {
  secretName?: string;
  items?: KeyToPath[];
  defaultMode?: number;
  optional?: boolean;
}

interface NFSVolumeSource {
  server?: string;
  path?: string;
  readOnly?: boolean;
}

interface CSIVolumeSource {
  driver?: string;
  readonly?: boolean;
  fsType?: string;
  volumeAttributes?: { [key: string]: string };
  controllerPublishSecretRef?: LocalObjectReference;
}

interface CSIPersistentVolumeSource {
  driver?: string;
  volumeHandle?: string;
  readOnly?: boolean;
  fsType?: string;
  volumeAttributes?: { [key: string]: string };
  controllerPublishSecretRef?: SecretReference;
  nodeStageSecretRef?: SecretReference;
  nodePublishSecretRef?: SecretReference;
  controlExpandSecretRef?: SecretReference;
  nodeExpandSecretRef?: SecretReference;
}

interface ISCSIVolumeSource {
  targetPortal?: string;
  iqn?: string;
  lun?: number;
  iscsiInterface?: string;
  fsType?: string;
  readOnly?: boolean;
  portals?: string[];
  chapAuthDiscovery?: boolean;
  chapAuthSession?: boolean;
  secretRef?: LocalObjectReference;
  initiatorName?: string;
}

type ISCSIPersistentVolumeSource = ISCSIVolumeSource & {};

interface FCVolumeSource {
  targetWWNs?: string[];
  lun?: number;
  fsType?: string;
  readOnly?: boolean;
  wwids?: string[];
}

interface AzureFileVolumeSource {
  secretName?: string;
  shareName?: string;
  readOnly?: boolean;
}

type AzureFilePersistentVolumeSource = AzureFileVolumeSource & {
  secretNamespace?: string;
};

interface VsphereVirtualDiskVolumeSource {
  volumePath?: string;
  fsType?: string;
  storagePolicyName?: string;
  storagePolicyID?: string;
}

interface PhotonPersistentDiskVolumeSource {
  pdID?: string;
  fsType?: string;
}

type AzureDataDiskCachingMode = "None" | "ReadOnly" | "ReadWrite";
type AzureDataDiskKind = "Shared" | "Dedicated" | "Managed";

interface AzureDiskVolumeSource {
  diskName?: string;
  diskURI?: string;
  cachingMode?: AzureDataDiskCachingMode;
  fsType?: string;
  readOnly?: boolean;
  kind?: AzureDataDiskKind;
}

interface PortworxVolumeSource {
  volumeID?: string;
  fsType?: string;
  readOnly?: boolean;
}

interface ScaleIOVolumeSource {
  gateway?: string;
  system?: string;
  secretRef?: SecretReference;
  sslEnabled?: boolean;
  protectionDomain?: string;
  storagePool?: string;
  storageMode?: string;
  volumeName?: string;
  fsType?: string;
  readOnly?: boolean;
}

// type ScaleIOPersistentVolumeSource = ScaleIOVolumeSource & {};

interface StorageOSVolumeSource {
  volumeName?: string;
  volumeNamespace?: string;
  fsType?: string;
  readOnly?: boolean;
  secretRef?: SecretReference;
}

type StorageOSPersistentVolumeSource = StorageOSVolumeSource & {};

type ConfigMapProjection = LocalObjectReference & {
  items?: KeyToPath[];
  optional?: boolean;
};

type ConfigMapVolumeSource = LocalObjectReference & {
  items?: KeyToPath[];
  defaultMode?: number;
  optional?: boolean;
};

interface ObjectReference {
  kind?: string;
  namespace?: string;
  name?: string;
  uid?: string;
  apiVersion?: string;
  resourceVersion?: string;
  fieldPath?: string;
}

interface SecretReference {
  name?: string;
  namespace?: string;
}

interface TypedObjectReference {
  apiGroup?: string;
  kind?: string;
  name?: string;
  namespace?: string;
}

type TypedLocalObjectReference = LocalObjectReference & {
  apiGroup?: string;
  kind?: string;
};

export interface LocalObjectReference {
  name?: string;
}

export interface KeyToPath {
  key?: string;
  path?: string;
  mode?: number;
}

interface HostPathVolumeSource {
  path?: string;
  type?: HostPathType;
}

interface EmptyDirVolumeSource {
  medium?: StorageMedium;
  sizeLimit?: Quantity;
}

interface Quantity {
  i?: number;
  d?: number;
  s?: string;
}

interface NamespaceSpec {
  finalizers?: string[];
}

type NamespacePhase = "Active" | "Terminating";

interface NamespaceStatus {
  phase?: NamespacePhase;
  conditions?: NamespaceCondition[];
}

type NamespaceConditionType =
  | "NamespaceDeletionDiscoveryFailure"
  | "NamespaceDeletionContentFailure"
  | "NamespaceDeletionGroupVersionParsingFailure"
  | "NamespaceContentRemaining"
  | "NamespaceFinalizersRemaining";

interface NamespaceCondition {
  type?: NamespaceConditionType;
  status?: ConditionStatus;
  lastTransitionTime?: string;
  reason?: string;
  message?: string;
}

export type NamespaceList = _ListType<Namespace>;
export type Namespace = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: NamespaceSpec;
  status?: NamespaceStatus;
};

// PVC
export type PersistentVolumeList = _ListType<PersistentVolume>;
export type PersistentVolume = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: PersistentVolumeSpec;
  status?: PersistentVolumeStatus;
};

type PersistentVolumeReclaimPolicy = "Recycle" | "Delete" | "Retain";
type PersistentVolumeSpec = PersistentVolumeSource & {
  capacity?: ResourceList;
  accessModes?: PersistentVolumeAccessMode[];
  claimRef?: ObjectReference;
  persistentVolumeReclaimPolicy?: PersistentVolumeReclaimPolicy;
  storageClassName?: string;
  mountOptions?: string[];
  volumeMode?: PersistentVolumeMode;
  nodeAffinity?: VolumeNodeAffinity;
  volumeAttributesClassName?: string;
};

interface VolumeNodeAffinity {
  required?: NodeSelector;
}

type PersistentVolumePhase =
  | "Pending"
  | "Available"
  | "Bound"
  | "Released"
  | "Failed";

interface PersistentVolumeStatus {
  phase?: PersistentVolumePhase;
  message?: string;
  reason?: string;
  lastPhaseThransitionTime?: string;
}

export type PodList = _ListType<Pod>;

export type ConfigMapList = _ListType<ConfigMap>;
export type ConfigMap = TypeMeta & {
  metadata?: ObjectMeta;
  immutable?: boolean;
  data?: { [key: string]: string };
  binaryData?: { [key: string]: any };
};

export interface PodTemplateSpec {
  metadata?: ObjectMeta;
  spec?: PodSpec;
}

export type DaemonSetList = _ListType<DaemonSet>;
export type DaemonSet = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: DaemonSetSpec;
  status?: DaemonSetStatus;
};

type DaemonSetUpdateStrategyType = "OnDelete" | "RollingUpdate";

export interface DaemonSetSpec {
  selector?: LabelSelector;
  template?: PodTemplateSpec;
  updateStrategy?: DaemonSetUpdateStrategy;
  minReadySeconds?: number;
  revisionHistoryLimit?: number;
}

interface DaemonSetUpdateStrategy {
  type?: DaemonSetUpdateStrategyType;
  rollingUpdate?: RollingUpdateDaemonSet;
}

interface RollingUpdateDaemonSet {
  maxUnavailable?: string | number;
  maxSurge?: string | number;
}

interface DaemonSetStatus {
  currentNumberScheduled?: number;
  numberMisscheduled?: number;
  desiredNumberScheduled?: number;
  numberReady?: number;
  observedGeneration?: number;
  updatedNumberScheduled?: number;
  numberAvailable?: number;
  numberUnavailable?: number;
  collisionCount?: number;
  conditions?: DaemonSetCondition[];
}

type DaemonSetConditionType = string;
interface DaemonSetCondition {
  type?: DaemonSetConditionType;
  status?: ConditionStatus;
  lastTransitionTime?: string;
  reason?: string;
  message?: string;
}

export type DeploymentList = _ListType<Deployment>;
export type Deployment = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: DeploymentSpec;
  status?: DeploymentStatus;
};

export interface DeploymentSpec {
  replicas?: number;
  selector?: LabelSelector;
  template?: PodTemplateSpec;
  strategy?: DeploymentStrategy;
  minReadySeconds?: number;
  revisionHistoryLimit?: number;
  paused?: boolean;
  progressDeadlineSeconds?: number;
}

export type DeploymentStrategyType = "Recreate" | "RollingUpdate";
export interface DeploymentStrategy {
  type?: DeploymentStrategyType;
  rollingUpdate?: RollingUpdateDeployment;
}

interface RollingUpdateDeployment {
  maxUnavailable?: string | number;
  maxSurge?: string | number;
}

interface DeploymentStatus {
  observedGeneration?: number;
  replicas?: number;
  updatedReplicas?: number;
  readyReplicas?: number;
  availableReplicas?: number;
  unavailableReplicas?: number;
  terminatingReplicas?: number;
  conditions?: DeploymentCondition[];
  collisionCount?: number;
}

type DeploymentConditionType = "Available" | "Progressing" | "ReplicaFailure";
export interface DeploymentCondition {
  type?: DeploymentConditionType;
  status?: ConditionStatus;
  lastUpdateTime?: string;
  lastTransitionTime?: string;
  reason?: string;
  message?: string;
}

export type IngressList = _ListType<Ingress>;
export type Ingress = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: IngressSpec;
  status?: IngressStatus;
};

export interface IngressSpec {
  ingressClassName?: string;
  defaultBackend?: IngressBackend;
  tls?: IngressTLS[];
  rules?: IngressRule[];
}

export interface IngressBackend {
  service?: IngressServiceBackend;
  resource?: TypedLocalObjectReference;
}

interface IngressServiceBackend {
  name?: string;
  port?: ServiceBackendPort;
}

interface ServiceBackendPort {
  name?: string;
  number?: number;
}

interface IngressTLS {
  hosts?: string[];
  secretName?: string;
}

export type IngressRule = IngressRuleValue & {
  host?: string;
};

interface IngressRuleValue {
  http?: HTTPIngressRuleValue;
}

interface HTTPIngressRuleValue {
  paths?: HTTPIngressPath[];
}
type PathType = "Exact" | "Prefix" | "ImplementationSpecific";
interface HTTPIngressPath {
  path?: string;
  pathType?: PathType;
  backend?: IngressBackend;
}

interface IngressStatus {
  loadBalancer?: IngressLoadBalancerStatus;
}

interface IngressLoadBalancerStatus {
  ingress?: IngressLoadBalancerIngress[];
}

interface IngressLoadBalancerIngress {
  ip?: string;
  hostname?: string;
  ports?: IngressPortStatus[];
}

interface IngressPortStatus {
  port?: number;
  protocol?: Protocol;
  error?: string;
}

export type PersistentVolumeClaimList = _ListType<PersistentVolumeClaim>;
export type PersistentVolumeClaim = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: PersistentVolumeClaimSpec;
  status?: PersistentVolumeClaimStatus;
};

interface PersistentVolumeClaimSpec {
  accessModes?: PersistentVolumeAccessMode[];
  selector?: LabelSelector;
  resources?: VolumeResourceRequirements;
  volumeName?: string;
  storageClassName?: string;
  volumeMode?: PersistentVolumeMode;
  dataSource?: TypedLocalObjectReference;
  dataSourceRef?: TypedObjectReference;
  volumeAttributesClassName?: string;
}

interface VolumeResourceRequirements {
  limits?: { [key in string]: Quantity };
  requests?: { [key in string]: Quantity };
}

type PersistentVolumeMode = "Block" | "Filesystem";

type PersistentVolumeAccessMode =
  | "ReadWriteOnce"
  | "ReadOnlyMany"
  | "ReadWriteMany"
  | "ReadWriteOncePod";

type PersistentVolumeClaimPhase = "Pending" | "Bound" | "Lost";
interface PersistentVolumeClaimStatus {
  phase?: PersistentVolumeClaimPhase;
  accessModes?: PersistentVolumeAccessMode[];
  capacity?: ResourceList;
  conditions?: PersistentVolumeClaimCondition[];
  allocatedResources?: ResourceList;
  allocatedResourceStatuses?: { [key in ResourceName]: ClaimResourceStatus };
  currentVolumeAttributesClassName?: string;
  modifyVolumeStatus?: ModifyVolumeStatus;
}

interface ModifyVolumeStatus {
  targetVolumeAttributesClassName?: string;
  status?: PersistentVolumeClaimModifyVolumeStatus;
}
type PersistentVolumeClaimModifyVolumeStatus =
  | "Pending"
  | "InProgress"
  | "Infeasible";

type ClaimResourceStatus =
  | "ControllerResizeInProgress"
  | "ControllerResizeInfeasible"
  | "NodeResizePending"
  | "NodeResizeInProgress"
  | "NodeResizeInfeasible";

interface PersistentVolumeClaimCondition {
  type?: PersistentVolumeClaimConditionType;
  status?: ConditionStatus;
  lastProbeTime?: string;
  lastTransitionTime?: string;
  reason?: string;
  message?: string;
}

type PersistentVolumeClaimConditionType =
  | "Resizing"
  | "FileSystemResizePending"
  | "ControllerResizeError"
  | "NodeResizeError"
  | "ModifyVolumeError"
  | "ModifyingVolume";

export enum SecretType {
  Opaque = "Opaque",
  ServiceAccountToken = "kubernetes.io/service-account-token",
  Dockercfg = "kubernetes.io/dockercfg",
  DockerConfigJson = "kubernetes.io/dockerconfigjson",
  BasicAuth = "kubernetes.io/basic-auth",
  SSHAuth = "kubernetes.io/ssh-auth",
  TLS = "kubernetes.io/tls",
  BootstrapToken = "bootstrap.kubernetes.io/token"
}
export type SecretList = _ListType<Secret>;

export type Secret = TypeMeta & {
  metadata?: ObjectMeta;
  immutable?: boolean;
  data?: { [key: string]: any };
  stringData?: string;
  type?: SecretType;
};

export type SecretDataDockerConfig = {
  auths: {
    [key: string]: {
      username: string;
      password?: string;
      email?: string;
      auth: string; // base64(username:password)
    };
  };
};

export type ServiceList = _ListType<Service>;

export type Service = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: ServiceSpec;
  status?: ServiceStatus;
};

export type ServiceType =
  | "None"
  | "ClusterIP"
  | "NodePort"
  | "LoadBalancer"
  | "ExternalName";
export type ServiceAffinity = "ClientIP" | "None";
export type ServiceExternalTrafficPolicy = "Cluster" | "Local";
interface ServiceSpec {
  ports?: ServicePort[];
  selector?: { [key: string]: string };
  clusterIP?: string;
  clusterIPs?: string[];
  type?: ServiceType;
  externalIPs?: string[];
  sessionAffinity?: ServiceAffinity;
  loadBalancerIP?: string;
  loadBalancerSourceRanges?: string[];
  externalName?: string;
  externalTrafficPolicy?: ServiceExternalTrafficPolicy;
  healthCheckNodePort?: number;
  publishNotReadyAddresses?: boolean;
  sessionAffinityConfig?: SessionAffinityConfig;
  ipFamilies?: IPFamily[];
  ipFamilyPolicy?: IPFamilyPolicy;
  allocateLoadBalancerNodePorts?: boolean;
  loadBalancerClass?: string;
  internalTrafficPolicy?: ServiceInternalTrafficPolicy;
  trafficDistribution?: string;
}

type IPFamily = "IPv4" | "IPv6" | "";
type IPFamilyPolicy = "SingleStack" | "PreferDualStack" | "RequireDualStack";
type ServiceInternalTrafficPolicy = "Cluster" | "Local";

export interface ServicePort {
  name?: string;
  protocol?: Protocol;
  appProtocol?: string;
  port?: number;
  targetPort?: string | number;
  nodePort?: number;
}

export type ServiceAccountList = _ListType<ServiceAccount>;
export type ServiceAccount = TypeMeta & {
  metadata?: ObjectMeta;
  secrets?: ObjectReference[];
  imagePullSecrets?: LocalObjectReference[];
  automountServiceAccountToken?: boolean;
};

interface SessionAffinityConfig {
  clientIP?: ClientIPConfig;
}

interface ClientIPConfig {
  timeoutSeconds?: number;
}

interface ServiceStatus {
  loadBalancer?: LoadBalancerStatus;
  conditions?: Condition[];
}

interface LoadBalancerStatus {
  ingress?: LoadBalancerIngress[];
}

interface LoadBalancerIngress {
  ip?: string;
  hostname?: string;
  ipMode?: LoadBalancerIPMode;
  ports?: PortStatus[];
}

type LoadBalancerIPMode = "VIP" | "Proxy";

interface PortStatus {
  port?: number;
  protocol?: Protocol;
  error?: string;
}

export interface Condition {
  type?: string;
  status?: ConditionStatus;
  observedGeneration?: number;
  lastTransitionTime?: string;
  reason?: string;
  message?: string;
}

export type StatefulSetList = _ListType<StatefulSet>;

export type StatefulSet = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: StatefulSetSpec;
  status?: StatefulSetStatus;
};

type PodManagementPolicy = "OrderedReady" | "Parallel";
export interface StatefulSetSpec {
  replicas?: number;
  selector?: LabelSelector;
  template?: PodTemplateSpec;
  volumeClaimTemplates?: PersistentVolumeClaim[];
  serviceName?: string;
  podManagementPolicy?: PodManagementPolicy;
  updateStrategy?: StatefulSetUpdateStrategy;
  revisionHistoryLimit?: number;
  minReadySeconds?: number;
  persistentVolumeClaimRetentionPolicy?: StatefulSetPersistentVolumeClaimRetentionPolicy;
  ordinals?: StatefulSetOrdinals;
}

interface StatefulSetOrdinals {
  start?: number;
}

type PersistentVolumeClaimRetentionPolicyType = "Retain" | "Delete";
interface StatefulSetPersistentVolumeClaimRetentionPolicy {
  whenDeleted?: PersistentVolumeClaimRetentionPolicyType;
  whenScaled?: PersistentVolumeClaimRetentionPolicyType;
}

type StatefulSetUpdateStrategyType = "RollingUpdate" | "OnDelete";

interface StatefulSetUpdateStrategy {
  type?: StatefulSetUpdateStrategyType;
  rollingUpdate?: RollingUpdateStatefulSetStrategy;
}

interface RollingUpdateStatefulSetStrategy {
  partition?: number;
  maxUnavailable?: string | number;
}

interface StatefulSetStatus {
  observedGeneration?: number;
  replicas?: number;
  readyReplicas?: number;
  currentReplicas?: number;
  updatedReplicas?: number;
  currentRevision?: string;
  updateRevision?: string;
  collisionCount?: number;
  conditions?: StatefulSetCondition[];
  availableReplicas?: number;
}

type StatefulSetConditionType = string;
interface StatefulSetCondition {
  type?: StatefulSetConditionType;
  status?: ConditionStatus;
  lastTransitionTime?: string;
  reason?: string;
  message?: string;
}

export type ReplicaSetList = _ListType<ReplicaSet>;
export type ReplicaSet = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: ReplicaSetSpec;
  status?: ReplicaSetStatus;
};

export interface ReplicaSetSpec {
  replicas?: number;
  minReadySeconds?: number;
  selector?: LabelSelector;
  template?: PodTemplateSpec;
}

export interface ReplicaSetStatus {
  replicas?: number;
  fullyLabeledReplicas?: number;
  readyReplicas?: number;
  availableReplicas?: number;
  terminatingReplicas?: number;
  observedGeneration?: number;
  conditions?: ReplicaSetCondition[];
}

type ReplicaSetConditionType = "ReplicaFailure";
interface ReplicaSetCondition {
  type?: ReplicaSetConditionType;
  status?: ConditionStatus;
  lastTransitionTime?: string;
  reason?: string;
  message?: string;
}

export type ResourceQuotaList = _ListType<ResourceQuota>;

// 资源配额
export type ResourceQuota = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: ResourceQuotaSpec;
  status?: ResourceQuotaStatus;
};

enum ResourceQuotaScope {
  "Terminating",
  "NotTerminating",
  "BestEffort",
  "NotBestEffort",
  "PriorityClass",
  "CrossNamespacePodAffinity",
  "VolumeAttributesClass"
}

enum ScopeSelectorOperator {
  "In",
  "NotIn",
  "Exists",
  "DoesNotExist"
}

export interface ResourceQuotaSpec {
  hard?: ResourceList; // 资源配额
  scopes?: ResourceQuotaScope[];
  scopeSelector?: ScopeSelector;
}

interface ScopeSelector {
  matchExpressions?: ScopedResourceSelectorRequirement[];
}

interface ScopedResourceSelectorRequirement {
  scopeName?: ResourceQuotaScope;
  operator?: ScopeSelectorOperator;
  values?: string[];
}

interface ResourceQuotaStatus {
  hard?: ResourceList;
  used?: ResourceList;
}

export type LimitRangeList = _ListType<LimitRange>;
export type LimitRange = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: LimitRangeSpec;
};

type LimitRangeSpec = {
  limits: LimitRangeItem[];
};

enum LimitType {
  "Pod",
  "Container",
  "PersistentVolumeClaim"
}

type LimitRangeItem = {
  type?: LimitType;
  max?: ResourceList;
  min?: ResourceList;
  default?: ResourceList;
  defaultRequest?: ResourceList;
  maxLimitRequestRatio?: ResourceList;
};

export type DeleteStatus = TypeMeta & {
  status?: string;
  metaata?: ObjectMeta;
  details?: {
    kind?: string;
    name?: string;
    uid?: string;
  };
};

export type RoleBindingList = _ListType<RoleBinding>;
export type RoleBinding = TypeMeta & {
  metadata?: ObjectMeta;
  subjects?: Subject[];
  roleRef?: RoleRef;
};

export type Subject = {
  kind?: string;
  apiGroup?: string;
  name?: string;
  namespace?: string;
};

export type RoleRef = {
  apiGroup?: string;
  kind?: string;
  name?: string;
};

export type ClusterRoleList = _ListType<ClusterRole>;
export type ClusterRole = TypeMeta & {
  metadata?: ObjectMeta;
  rules?: PolicyRule[];
  aggregationRule?: AggregationRule;
};

type AggregationRule = {
  clusterRoleSelectors?: LabelSelector;
};

type PolicyRule = {
  verbs?: string[];
  apiGroups?: string[];
  resources?: string[];
  resourceNames?: string[];
  nonResourceURLs?: string[];
};

export type RoleList = _ListType<Role>;
export type Role = TypeMeta & {
  metadata?: ObjectMeta;
  rules?: PolicyRule[];
};

export type EventList = _ListType<Event>;
export type Event = TypeMeta & {
  metadata?: ObjectMeta;
  involvedObject?: ObjectReference;
  reason?: string;
  message?: string;
  source?: EventSource;
  firstTimestamp?: string;
  lastTimestamp?: string;
  count?: number;
  type?: string;
  eventTime?: string;
  series?: EventSeries;
  action?: string;
  related?: ObjectReference;
  reportingComponent?: string;
  reportingInstance?: string;
};

type EventSeries = {
  lastObservedTime?: string;
  count?: number;
};

export type Eviction = TypeMeta & {
  metadata?: ObjectMeta;
  deleteOptions?: DeleteOptions;
};

type DeleteOptions = TypeMeta & {
  gracePeriodSeconds?: number;
  preconditions?: Precondition;
  orphanDependents?: boolean;
  propagationPolicy?: DeletionPropagation;
  dryRun?: string[];
  ignoreStoreReadErrorWithClusterBreakingPotential?: boolean;
};

type Precondition = {
  uid?: string;
  resourceVersion?: string;
};

enum DeletionPropagation {
  "Orphan",
  "Background",
  "Foreground"
}

export type JobList = _ListType<Job>;
export type Job = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: JobSpec;
  status?: JobStatus;
};

export type CompletionMode = "NonIndexed" | "Indexed";
export type PodReplacementPolicy = "TerminatingOrFailed" | "Failed";
export type JobSpec = {
  parallelism?: number; // 并行度
  completions?: number; // 完成数
  activeDeadlineSeconds?: number; // 活跃截止时间
  podFailurePolicy?: PodFailurePolicy;
  successPolicy?: SuccessPolicy;
  backoffLimit?: number; // 重试次数
  backoffLimitPerIndex?: number; // 每个索引的重试次数
  maxFailedIndexes?: number; // 最大失败索引
  selector?: LabelSelector; // 选择器
  manualSelector?: boolean; // 手动选择器
  template: PodTemplateSpec; // 模板
  ttlSecondsAfterFinished?: number; // 完成后删除时间
  completionMode?: CompletionMode; // 完成模式
  suspend?: boolean; // 挂起
  podReplacementPolicy?: PodReplacementPolicy; // pod替换策略
  managedBy?: string; // 管理者
};

type JobStatus = {
  conditions: JobCondition[];
  startTime?: string;
  completionTime?: string;
  active?: number;
  succeeded?: number;
  failed?: number;
  terminating?: number;
  completedIndexes: string;
  failedIndexes?: string;
  uncountedTerminatedPods?: UncountedTerminatedPods;
  ready?: number;
};

type UncountedTerminatedPods = {
  succeeded?: string[];
  failed?: string[];
};

type PodFailurePolicy = {
  rules?: PodFailurePolicyRule[];
};

type PodFailurePolicyAction = "FailJob" | "FailIndex" | "Ignore" | "Count";
type PodFailurePolicyRule = {
  action?: PodFailurePolicyAction;
  onExitCodes?: PodFailurePolicyOnExitCodesRequirement;
  onPodConditions?: PodFailurePolicyOnPodConditionsPattern[];
};
type PodFailurePolicyOnExitCodesOperator = "In" | "NotIn";
type PodFailurePolicyOnExitCodesRequirement = {
  containerName?: string;
  operator?: PodFailurePolicyOnExitCodesOperator;
  values?: number[];
};

type PodFailurePolicyOnPodConditionsPattern = {
  type?: PodConditionType;
  status: ConditionStatus;
};

type SuccessPolicy = {
  rules?: SuccessPolicyRule[];
};
type SuccessPolicyRule = {
  succeededIndexes?: string;
  succeededCount?: number;
};

type JobConditionType =
  | "Suspended"
  | "Complete"
  | "Failed"
  | "FailureTarget"
  | "SuccessCriteriaMet";

export type JobCondition = {
  type?: JobConditionType;
  status?: ConditionStatus;
  lastProbeTime?: string;
  lastTransitionTime?: string;
  reason?: string;
  message?: string;
};

export type CronJobList = _ListType<CronJob>;
export type CronJob = TypeMeta & {
  metadata?: ObjectMeta;
  spec?: CronJobSpec;
  status?: CronJobStatus;
};

type ConcurrencyPolicy = "Allow" | "Forbid" | "Replace";

type CronJobSpec = {
  schedule?: string; // 调度时间
  timeZone?: string; // 时区
  startingDeadlineSeconds?: number; // 开始截止时间
  concurrencyPolicy?: ConcurrencyPolicy; // 并发策略
  suspend?: boolean; // 挂起
  jobTemplate?: JobTemplateSpec; // 任务模板
  successfulJobsHistoryLimit?: number; // 成功历史限制
  failedJobsHistoryLimit?: number; // 失败历史限制
};

export type JobTemplateSpec = {
  metadata?: ObjectMeta;
  spec?: JobSpec;
};

type CronJobStatus = {
  active?: ObjectReference[];
  lastScheduleTime?: string;
  lastSuccessfulTime?: string;
};

type VolumeBindingMode = "Immediate" | "WaitForFirstConsumer";
export type StorageType =
  | "PersistentVolumeClaim"
  | "EmptyDir"
  | "HostPath"
  | "ConfigMap"
  | "Secret";

export type SotrageClassList = _ListType<StorageClass>;
export type StorageClass = TypeMeta & {
  metadata?: ObjectMeta;
  provisioner?: string;
  parameters?: Record<string, string>;
  reclaimPolicy?: PersistentVolumeReclaimPolicy;
  mountOptions?: string[];
  allowVolumeExpansion?: boolean;
  volumeBindingMode?: VolumeBindingMode;
  allowTopologies?: TopologySelectorTerm[];
};

type TopologySelectorTerm = {
  matchLabelExpressions?: TopologySelectorLabelRequirement[];
};

type TopologySelectorLabelRequirement = {
  key?: string;
  values?: string[];
};
